package com.zyc.fuckfx.apk;

import com.zyc.fuckfx.ImpliedFeature;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * apk实体信息
 */
public class ApkInfo {
    public static final String APPLICATION_ICON_120 = "application-icon-120";
    public static final String APPLICATION_ICON_160 = "application-icon-160";
    public static final String APPLICATION_ICON_240 = "application-icon-240";
    public static final String APPLICATION_ICON_320 = "application-icon-320";
    /**
     * apk内部版本号
     */
    private String versionCode = null;
    /**
     * apk外部版本号
     */
    private String versionName = null;
    /**
     * apk的包名
     */
    private String packageName = null;
    /**
     * 支持的android平台最低版本号
     */
    private String minSdkVersion = null;
    /**
     * apk所需要的权限
     */
    private List<String> usesPermissions = null;
    /**
     * 支持的SDK版本。
     */
    private String sdkVersion;
    /**
     * 建议的SDK版本
     */
    private String targetSdkVersion;
    /**
     * 应用程序名
     */
    private String appName;
    /**
     * 各个分辨率下的图标的路径。
     */
    private Map<String, String> appIcons;
    /**
     * 程序的图标。
     */
    private String appIcon;
    /**
     * 暗指的特性。
     */
    private List<ImpliedFeature> impliedFeatures;
    /**
     * 所需设备特性。
     */
    private List<String> features;
    /**
     * 启动界面
     */
    private String launchableActivity;
    /**
     * 支持架构
     */
    private List<String> nativeCodes;

    private String rsaPath = "";

    private String channelPath = "";

    private String sha1 = "";
    private String sha256 = "";
    private String md5 = "";


    public ApkInfo() {
        this.usesPermissions = new ArrayList<String>();
        this.appIcons = new HashMap<String, String>();
        this.impliedFeatures = new ArrayList<ImpliedFeature>();
        this.features = new ArrayList<String>();
    }

    public String getSha1() {
        return sha1;
    }

    public void setSha1(String sha1) {
        this.sha1 = sha1;
    }

    public String getSha256() {
        return sha256;
    }

    public void setSha256(String sha256) {
        this.sha256 = sha256;
    }

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public String getRsaPath() {
        return rsaPath;
    }

    public String getChannelPath() {
        return channelPath;
    }

    public void setChannelPath(String channelPath) {
        this.channelPath = channelPath;
    }

    public void setRsaPath(String rsaPath) {
        this.rsaPath = rsaPath;
    }

    /**
     * 返回版本代码。
     *
     * @return 版本代码。
     */
    public String getVersionCode() {
        return versionCode;
    }

    /**
     * @param versionCode the versionCode to set
     */
    public void setVersionCode(String versionCode) {
        this.versionCode = versionCode;
    }

    /**
     * 返回版本名称。
     *
     * @return 版本名称。
     */
    public String getVersionName() {
        return versionName;
    }

    /**
     * @param versionName the versionName to set
     */
    public void setVersionName(String versionName) {
        this.versionName = versionName;
    }

    /**
     * 返回支持的最小sdk平台版本。
     *
     * @return the minSdkVersion
     */
    public String getMinSdkVersion() {
        return minSdkVersion;
    }

    /**
     * @param minSdkVersion the minSdkVersion to set
     */
    public void setMinSdkVersion(String minSdkVersion) {
        this.minSdkVersion = minSdkVersion;
    }

    /**
     * 返回包名。
     *
     * @return 返回的包名。
     */
    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    /**
     * 返回sdk平台版本。
     *
     * @return
     */
    public String getSdkVersion() {
        return sdkVersion;
    }

    public void setSdkVersion(String sdkVersion) {
        this.sdkVersion = sdkVersion;
    }

    /**
     * 返回所建议的SDK版本。
     *
     * @return
     */
    public String getTargetSdkVersion() {
        return targetSdkVersion;
    }

    public void setTargetSdkVersion(String targetSdkVersion) {
        this.targetSdkVersion = targetSdkVersion;
    }

    /**
     * 返回所需的用户权限。
     *
     * @return
     */
    public List<String> getUsesPermissions() {
        return usesPermissions;
    }

    public void setUsesPermissions(List<String> usesPermission) {
        this.usesPermissions = usesPermission;
    }

    public void addToUsesPermissions(String usesPermission) {
        this.usesPermissions.add(usesPermission);
    }

    /**
     * 返回程序的名称标签。
     *
     * @return
     */
    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    /**
     * 返回应用程序的图标。
     *
     * @return
     */
    public String getAppIcon() {
        return appIcon;
    }

    public void setAppIcon(String appIcon) {
        this.appIcon = appIcon;
    }

    /**
     * 返回应用程序各个分辨率下的图标。
     *
     * @return
     */
    public Map<String, String> getAppIcons() {
        return appIcons;
    }

    public void setAppIcons(Map<String, String> appIcons) {
        this.appIcons = appIcons;
    }

    public void addToApplicationIcons(String key, String value) {
        this.appIcons.put(key, value);
    }

    public void addToImpliedFeatures(ImpliedFeature impliedFeature) {
        this.impliedFeatures.add(impliedFeature);
    }

    /**
     * 返回应用程序所需的暗指的特性。
     *
     * @return
     */
    public List<ImpliedFeature> getImpliedFeatures() {
        return impliedFeatures;
    }

    public void setImpliedFeatures(List<ImpliedFeature> impliedFeatures) {
        this.impliedFeatures = impliedFeatures;
    }

    /**
     * 返回应用程序所需的特性。
     *
     * @return
     */
    public List<String> getFeatures() {
        return features;
    }

    public void setFeatures(List<String> features) {
        this.features = features;
    }

    public void addToFeatures(String feature) {
        this.features.add(feature);
    }

    public List<String> getNativeCodes() {
        return nativeCodes;
    }

    public void setNativeCodes(List<String> nativeCodes) {
        this.nativeCodes = nativeCodes;
    }

    @Override
    public String toString() {
        return "ApkInfo{" +
                "versionCode='" + versionCode + '\'' +
                ", versionName='" + versionName + '\'' +
                ", packageName='" + packageName + '\'' +
                ", minSdkVersion='" + minSdkVersion + '\'' +
                ", usesPermissions=" + usesPermissions +
                ", sdkVersion='" + sdkVersion + '\'' +
                ", targetSdkVersion='" + targetSdkVersion + '\'' +
                ", appName='" + appName + '\'' +
                ", appIcons=" + appIcons +
                ", appIcon='" + appIcon + '\'' +
                ", impliedFeatures=" + impliedFeatures +
                ", features=" + features +
                ", launchableActivity='" + launchableActivity + '\'' +
                ", nativeCodes=" + nativeCodes +
                ", rsaPath='" + rsaPath + '\'' +
                ", channelPath='" + channelPath + '\'' +
                ", sha1='" + sha1 + '\'' +
                ", sha256='" + sha256 + '\'' +
                ", md5='" + md5 + '\'' +
                '}';
    }

    public String getLaunchableActivity() {
        return launchableActivity;
    }

    public void setLaunchableActivity(String launchableActivity) {
        this.launchableActivity = launchableActivity;
    }
}